package com.hiva.gmovie;

/**
 * Hello world!
 *
 */
import com.hiva.gmovie.connection.GMovieReader;
import com.hiva.gmovie.domain.MovieTheater;
import java.io.IOException;
import net.htmlparser.jericho.*;
import java.util.*;
import java.net.*;
import java.util.logging.Level;

public class App {

    public static void main(String[] args) {
        
        GMovieReader reader = new GMovieReader();
        List<MovieTheater> theaters = reader.readMovieTheaterPage();
        
        for (MovieTheater movieTheater : theaters) {
            System.out.println("\n---------- Theater ----------\n");
            System.out.println(movieTheater.toString());
        }
        
        
        
//        String sourceUrlString = "data/test.html";
//
//        if (args.length == 0) {
//            System.err.println("Using default argument of \"" + sourceUrlString + '"');
//        } else {
//            sourceUrlString = args[0];
//        }
//        if (sourceUrlString.indexOf(':') == -1) {
//            sourceUrlString = "file:" + sourceUrlString;
//        }
//
//        Source source = null;
//        try {
//            //source = new Source(new URL(sourceUrlString));
//            source = new Source(new URL("http://www.google.com.br/movies?near=natal"));
//        } catch (IOException ex) {
//            java.util.logging.Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
//        }
//
//        System.out.println(source.getTextExtractor().toString());
//
//        List<Element> linkElements = source.getAllElements("div class=theater");
//        for (Element linkElement : linkElements) {
//            List<Element> allElements = linkElement.getAllElements(HTMLElementName.A);
//            int i = 0;
//            /*String href = linkElement.getAllTags();
//            if (href != null) {
//            System.out.println(href);
//            }*/
//        }
    }
    
    

}
